package chen.web.forum;

import java.util.Calendar;
import java.util.Date;

public class CategoryDynamicInfo {
		private int postCount;
		private int subjectCount;
		private int todayPostCount;
		private int yesterdayPostCount;
		private int lastPostAuthorId;
		private String lastPostAuthorNickname;
		private Date lastPostDate = new Date(0);
		
		CategoryDynamicInfo(){}
		
		public int getPostCount() {
			return postCount;
		}

		void setPostCount(int postCount) {
			this.postCount = postCount;
		}

		public int getSubjectCount() {
			return subjectCount;
		}

		void setSubjectCount(int subjectCount) {
			this.subjectCount = subjectCount;
		}

		
		public int getTodayPostCount() {
			return todayPostCount;
		}

		void setTodayPostCount(int todayPostCount) {
			this.todayPostCount = todayPostCount;
		}

		void setLastPostDate(Date lastPostDate) {
			this.lastPostDate = lastPostDate;
		}

		public Date getLastPostDate() {
			return lastPostDate;
		}

		void setLastPostAuthorId(int lastPostAuthorId) {
			this.lastPostAuthorId = lastPostAuthorId;
		}

		public int getLastPostAuthorId() {
			return lastPostAuthorId;
		}

		void setLastPostAuthorNickname(String lastPostAuthorNickname) {
			this.lastPostAuthorNickname = lastPostAuthorNickname;
		}

		public String getLastPostAuthorNickname() {
			return lastPostAuthorNickname;
		}

		void setYesterdayPostCount(int yesterdayPostCount) {
			this.yesterdayPostCount = yesterdayPostCount;
		}

		public int getYesterdayPostCount() {
			return yesterdayPostCount;
		}

		public static Date today(){
			return _today().getTime();
		}
		
		public static Date tomorrow(){
			Calendar tomorrow = _today();
			tomorrow.add(Calendar.DAY_OF_MONTH, 1);
			return tomorrow.getTime();
		}
		
		public static Date yesterday(){
			Calendar yesterday = _today();
			yesterday.add(Calendar.DAY_OF_MONTH, -1);
			return yesterday.getTime();
		}
		
		private static Calendar _today(){
			Calendar today = Calendar.getInstance();
			today.set(Calendar.HOUR_OF_DAY, 0);
			today.set(Calendar.MINUTE, 0);
			today.set(Calendar.SECOND, 0);
			today.set(Calendar.MILLISECOND, 0);
			return today;
		}
		
	
}
